<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    * {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .nav {
        width: 1200px;
        height: 600px;
        margin: 200px auto;
    }

    .nav ul {
        margin-left: 10%;
        width: 600px;
        height: 300px;
    }
    .nav li {
            float: left;
            background: pink;
            text-align: center;
            width: 100px;
            height: 30px;
            cursor: pointer;
            line-height: 30px;
            color: #fff;
        }
        .nav li:hover{
            background: chocolate;
        }
        .nav li dl dd:hover{
            background: rgb(216, 12, 124);
        }
        .nav li dl{
            margin-top: 0;
            color: #000;
            background: coral;
            display: none;
        }
</style>

<body>
    <div class="nav">
        <ul class="nav_ul">
            <li>微博
                <dl class="nav_dl">
                    <dd>私信</dd>
                    <dd>评论</dd>
                    <dd>@我</dd>
                </dl>
            </li>
            <li>微博
                <dl class="nav_dl">
                    <dd>666</dd>
                    <dd>评论</dd>
                    <dd>@我</dd>
                </dl>
            </li>
            <li>微博
                <dl class="nav_dl">
                    <dd>555</dd>
                    <dd>评论</dd>
                    <dd>@我</dd>
                </dl>
            </li>
            <li>微博
                <dl class="nav_dl">
                    <dd>888</dd>
                    <dd>评论</dd>
                    <dd>@我</dd>
                </dl>
            </li>
        </ul>
    </div>

    <script>
        //1、获取元素
        var ul = document.querySelector('.nav_ul');
        var lis = ul.children; //得到所有的Li
        //给每一个li添加点击事件
        for(var i =0; i < lis.length; i++){
            //给某一个li添加点击事件
            lis[i].onmouseover = function(){
                console.log(111);
                //点击的时候显示该li中的内容
                this.children[0].style.display = 'block'
            }
            //当鼠标离开的时候隐藏li中的第二个孩子节点
            lis[i].onmouseout = function(){
                //点击的时候显示该li中的内容
                this.children[0].style.display = 'none'
            }

        }
    </script>

</body>

</html>